﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;

namespace SimpleNoteLib.HttpRequests
{
    internal class DeleteHttpRequest : IHttpRequest
    {
        public string Address { get; set; }
        public IWebProxy Proxy { get; set; }
        public byte[] Data { get; set; }

        public virtual string SendAndGetResponse()
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Address);

            request.Proxy = Proxy;

            request.Method = "DELETE";
            request.ContentType = "application/json";
            request.UserAgent = "MyApp/0.5.0";

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            string result = new StreamReader(response.GetResponseStream()).ReadToEnd();
            return result;
        }
    }
}
